package cn.rkylin.oms.warehouse.stockGoods.service;

import cn.rkylin.core.service.ApolloService;
import cn.rkylin.oms.warehouse.stockGoods.dao.IStockGoodsDAO;
import cn.rkylin.oms.warehouse.stockGoods.domain.StockGoods;
import cn.rkylin.oms.warehouse.stockGoods.vo.StockGoodsExportVO;
import cn.rkylin.oms.warehouse.stockGoods.vo.StockGoodsVO;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


/**
 * 库存汇总查询服务实现类
 *
 * @author zhangheng
 * @date 2018/01/23
 */
@Service("stockGoodsService")
public class StockGoodsServiceImpl extends ApolloService implements IStockGoodsService{

    @Autowired
    private IStockGoodsDAO stockGoodsDAO;

    /**
     * queryStockList：根据查询条件获取商品库存汇总信息列表
     */
    public PageInfo<StockGoodsVO> queryStockGoodsList(int page, int length, StockGoodsVO queryParamVO) throws Exception {
        return stockGoodsDAO.selectPagedByCondition(page, length, queryParamVO);
    }


    /**
     * getStockGoodsLocaStorInfo:查询商品本地库各个仓库存储情况
     */
    @Override
    public List<StockGoodsVO> getStockGoodsLocaStorInfo(StockGoodsVO queryParamVO) throws Exception {
        return stockGoodsDAO.getStockGoodsLocaStorInfo(queryParamVO);
    }

    /**
     * getStockGoodsExtStorInfo:查询商品第三方库各个仓库存储情况
     */
    @Override
    public List<StockGoodsVO> getStockGoodsExtStorInfo(StockGoodsVO queryParamVO) throws Exception {
        return stockGoodsDAO.getStockGoodsExtStorInfo(queryParamVO);
    }
    /**
     * @throws Exception
     * @see cn.rkylin.oms.aftersale.sysrefund.servcie.ISysRefundService#getSysRefundDetailById(java.lang.String)
     */
    @Override
    public StockGoodsVO getStockGoodsDetail(String goodsId) throws Exception {
        StockGoodsVO returnValue = stockGoodsDAO.selectDetailByPrimaryKey(goodsId);
        return returnValue;
    }

    @Override
    public List<StockGoodsExportVO> getExportList(Map reqMap, String statement) throws Exception{
        return stockGoodsDAO.getExportList(reqMap,statement);
    }
}